USE [influenza]
GO
/****** Object:  StoredProcedure [dbo].[SP_Buscador_simple]    Script Date: 03/09/2010 14:05:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

/*
ALTER PROCEDURE [dbo].[SP_Buscador_simple]
*/
ALTER PROCEDURE [dbo].[SP_Buscador_simple]
@tabla varchar(100),
@campos varchar(255),
@param varchar(255),
@orden varchar(255)
as
Begin

declare @qry varchar(800)
declare @txt varchar(800)

IF @orden != ''
	BEGIN
		SET @txt = ' ORDER BY ' + @orden
	END

set @qry = 'SELECT ' + @campos + '
            FROM ' + @tabla + '
            WHERE 0=0 AND ' + @param + ' ' + @txt
exec (@qry)
End
